package com.star.controller;

import com.star.pojo.vo.BlogQuery;
import com.star.service.BlogService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;
import java.util.List;

/**
 * 时间轴页面显示控制器
 *
 * @author tanyapeng
 * @date 2021/2/5
 */
@Controller
public class ArchiveShowController {

    @Resource
    private BlogService blogService;

    /**
     * 获取所有博客
     *
     * @param model
     * @return
     */
    @GetMapping("/archives")
    public String archive(Model model) {
        List<BlogQuery> blogs = blogService.getAllBlog();
        model.addAttribute("blogs", blogs);
        return "archives";
    }

}